/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2016
 */

package com.jzwl.site.manager.coperatev2.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.jzwl.common.page.PageObject;
import com.jzwl.site.manager.coperatev2.service.SiteCoperateV2Service;
import com.jzwl.system.base.controller.BaseController;

/**
 * SiteCoperateV2
 * SiteCoperateV2
 * siteCoperateV2
 * <p>Title:SiteCoperateV2Controller </p>
 * 	<p>Description:SiteCoperateV2 </p>
 * 	<p>Company: </p> 
 * 	@author aotu-code 
 */
@Controller
@RequestMapping("/siteCoperateV2")
public class SiteCoperateV2Controller  extends BaseController {
	
	@Autowired
	private SiteCoperateV2Service siteCoperateV2Service;
	/**
	 * 跳转到添加SiteCoperateV2的页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/toAddSiteCoperateV2")
	public ModelAndView toAddsiteCoperateV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView();
		
		createParameterMap(request);
		
		mov.setViewName("/manager/coperatev2/add");
		return mov;
	}
	
	/**
	 * 添加SiteCoperateV2
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/addSiteCoperateV2")
	public ModelAndView addsiteCoperateV2(HttpServletRequest request, HttpServletResponse response) {
		Map<String,Object> resultMap = new HashMap<String,Object>();
		ModelAndView mov = new ModelAndView();
		
		createParameterMap(request);
		
		try{
			boolean flag = siteCoperateV2Service.addSiteCoperateV2(paramsMap);
			if(!flag){
				mov.addObject("msg", "添加SiteCoperateV2失败!");
				mov.setViewName("/error");
			}else{
				mov.setViewName("redirect:/siteCoperateV2/siteCoperateV2List.html");
			}
		}catch(Exception e){
			e.printStackTrace();
			mov.addObject("msg", "添加SiteCoperateV2失败!");
			mov.setViewName("/error");
		}
		
		
		return mov;
	}
	
	/**
	 * siteCoperateV2list
	 */
	@RequestMapping(value = "/siteCoperateV2List")
	public ModelAndView siteCoperateV2List(HttpServletRequest request, HttpServletResponse response) {
	
		ModelAndView mov = new ModelAndView();
		
		createParameterMap(request);
		
		PageObject po = new PageObject();
		
		try{
		
			po = siteCoperateV2Service.querySiteCoperateV2List(paramsMap);
			
			mov.addObject("list", po.getDatasource());
			mov.addObject("totalProperty", po.getTotalCount());
			mov.addObject("po", po);
			mov.addObject("paramsMap", paramsMap);
			mov.setViewName("/manager/coperatev2/list");
		}catch(Exception e){
		
			e.printStackTrace();
			mov.addObject("msg", "siteCoperateV2查询失败");
			mov.setViewName("/error");
		}
		
		return mov;
	}
	
	
	/**
	 * 跳转到修改siteCoperateV2页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/toUpdateSiteCoperateV2")
	public ModelAndView toUpdateSiteCoperateV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView();
		
		createParameterMap(request);
		
		try{
			Map<String,Object> siteCoperateV2=siteCoperateV2Service.getById(paramsMap);
			mov.addObject("obj", siteCoperateV2);
			mov.setViewName("/manager/coperatev2/update");
		}catch(Exception e){
			e.printStackTrace();
			mov.addObject("msg", "siteCoperateV2查询失败");
			mov.setViewName("/error");
		}
		
		return mov;
	}
	
	/**
	 * 跳转到详情siteCoperateV2页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/detailSiteCoperateV2")
public ModelAndView detailSiteCoperateV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView();
		
		createParameterMap(request);
		
		try{
			Map<String,Object> siteCoperateV2=siteCoperateV2Service.getById(paramsMap);
			mov.addObject("obj", siteCoperateV2);
			mov.setViewName("/manager/coperatev2/detail");
		}catch(Exception e){
			e.printStackTrace();
			mov.addObject("msg", "siteCoperateV2查询失败");
			mov.setViewName("/error");
		}
		
		return mov;
	}
	/**
	 * 修改siteCoperateV2
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/updateSiteCoperateV2")
	public ModelAndView updateSiteCoperateV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView(); 
		
		createParameterMap(request);
		
		try{
		
			boolean flag = siteCoperateV2Service.updateSiteCoperateV2(paramsMap);
			
			if(!flag){
				mov.addObject("msg", "修改失败!");
				mov.setViewName("/error");
			}else{
				mov.setViewName("redirect:/siteCoperateV2/siteCoperateV2List.html");
			}
		}catch(Exception e){
		
			e.printStackTrace();
			mov.addObject("msg", "修改失败!");
			mov.setViewName("/error");
		}
		
		return mov;
	}
	
	
	/**
	 * 逻辑删除siteCoperateV2
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/delSiteCoperateV2")
	public ModelAndView delSiteCoperateV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView(); 
		
		createParameterMap(request);
		
		try{
		
			boolean flag = siteCoperateV2Service.deleteSiteCoperateV2(paramsMap);
			
			if(!flag){
				mov.addObject("msg", "删除失败!");
				mov.setViewName("/error");
			}else{
				mov.setViewName("redirect:/siteCoperateV2/siteCoperateV2List.html");
			}
		}catch(Exception e){
			
			e.printStackTrace();
			mov.addObject("msg", "删除失败!");
			mov.setViewName("/error");
		
		}
		
		return mov;
	}
	
	
	/**
	 * 物理删除siteCoperateV2
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/deleteSiteCoperateV2")
	public ModelAndView deleteSiteCoperateV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView(); 
		
		createParameterMap(request);
		
		try{
		
			boolean flag = siteCoperateV2Service.deleteSiteCoperateV2(paramsMap);
			
			if(!flag){
				mov.addObject("msg", "删除失败!");
				mov.setViewName("/error");
			}else{
				mov.setViewName("redirect:/siteCoperateV2/siteCoperateV2List.html");
			}
		}catch(Exception e){
			
			e.printStackTrace();
			mov.addObject("msg", "删除失败!");
			mov.setViewName("/error");
		
		}
		
		return mov;
	}
	
	//auto-code-end
	
	
}

